package com.iaz.tech.tools.main;

import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Properties;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.iaz.tech.tools.ai.neuron.cell.OrganizationCell;
import com.iaz.tech.tools.ai.neuron.proj.NeuronProjectTools;
import com.iaz.tech.tools.ai.neuron.runtime.impl.NeuronsWorld;
import com.iaz.tech.tools.common.utils.ExpressionUtil;
import com.iaz.tech.tools.common.utils.StringUtil;
import com.iaz.tech.tools.common.utils.UtilTools;
import com.iaz.tech.tools.message.impl.MessageForTalk;
import com.iaz.tech.tools.property.impl.PropertyGroup;
import com.iaz.tech.tools.property.project.Project;
import com.iaz.tech.tools.tasks.ability.ITaskItemAble;
import com.iaz.tech.tools.tasks.pool.ZTecThreadsPool;

/**
 * 主要程序
 */
public class NeuronMainTools {
	private final static Logger logger = (Logger) LoggerFactory.getLogger(NeuronMainTools.class);

	/**
	 * 线程池
	 */
	private static ZTecThreadsPool pool =  new ZTecThreadsPool(30, 20, 6, 4);
	
	/**
	 * 主程序
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			System.out.println("out Regext1:" + StringUtil.isMathSymbol("+"));
			System.out.println("out Regext2:" + StringUtil.isMathSymbol("-"));
			System.out.println("out Regext3:" + StringUtil.isMathSymbol("*"));
			System.out.println("out Regext4:" + StringUtil.isMathSymbol("/"));
	        System.out.println("out Regext5:" + StringUtil.isMathSymbol("++"));
			System.out.println("out Regext6:" + StringUtil.isMathSymbol("--"));

			System.out.println("out Regext5-2:" + StringUtil.isMathSymbol("+++"));
			System.out.println("out Regext6-2:" + StringUtil.isMathSymbol("---"));

			System.out.println("out Regext7:" + StringUtil.isMathSymbol("=="));
			System.out.println("out Regext8:" + StringUtil.isMathSymbol("!="));

  			System.out.println("out Regext9:" + StringUtil.isMathSymbol("+="));
			System.out.println("out Regext10:" + StringUtil.isMathSymbol("-="));
			System.out.println("out Regext11:" + StringUtil.isMathSymbol("*="));
			System.out.println("out Regext12:" + StringUtil.isMathSymbol("/="));
			
			System.out.println("out Regext13:" + StringUtil.isMathSymbol(">="));

			System.out.println("out Regext14:" + StringUtil.isMathSymbol(">"));
			System.out.println("out Regext15:" + StringUtil.isMathSymbol("<"));

			System.out.println("out Regext14-2:" + StringUtil.isMathSymbol(">>"));
			System.out.println("out Regext15-2:" + StringUtil.isMathSymbol("<<"));

			System.out.println("out Regext16:" + StringUtil.isMathSymbol("<="));
			System.out.println("out Regext17:" + StringUtil.isMathSymbol(">="));

			System.out.println("out Regext18:" + StringUtil.isMathSymbol("^"));
			System.out.println("out Regext19:" + StringUtil.isMathSymbol("^="));
			System.out.println("out Regext20:" + StringUtil.isMathSymbol("("));
			System.out.println("out Regext21:" + StringUtil.isMathSymbol("()"));
			System.out.println("out Regext22:" + StringUtil.isMathSymbol(")"));
			System.out.println("out Regext23:" + StringUtil.isMathSymbol("["));
			System.out.println("out Regext24:" + StringUtil.isMathSymbol("]"));
			System.out.println("out Regext25:" + StringUtil.isMathSymbol("{"));
			System.out.println("out Regext26:" + StringUtil.isMathSymbol("}"));
			System.out.println("out Regext27:" + StringUtil.isMathSymbol("[]"));
			System.out.println("out Regext28:" + StringUtil.isMathSymbol("{}"));
			/* 根据UML 加载Neuron  */
			String path = "D:\\work\\Temp\\usecase";		
			System.out.println("out execute----1:" + ExpressionUtil.ScanExpression("1*2 + 3"));
			System.out.println("out execute----2:" + ExpressionUtil.ScanExpression("1 + 2 + 3"));
			System.out.println("out execute----3:" + ExpressionUtil.ScanExpression("1 + 2 + 3 * 2"));
			System.out.println("out execute----4:" + ExpressionUtil.ScanExpression("5*(2 + 3) * 4/12"));
			System.out.println("out execute----5:" + ExpressionUtil.ScanExpression("2 * (2 + 3) * ( 4 +12)"));
			System.out.println("out execute----6:" + ExpressionUtil.ScanExpression("(2 + (2 + 3)) * ( 4 +12)"));
			System.out.println("out execute----7:" + ExpressionUtil.ScanExpression("(2 + (2 * 3)) * ( 4 +12)"));
			System.out.println("out execute----8:" + ExpressionUtil.ScanExpression("(2 * (2 + 3)) * ( 5 -12)"));
			System.out.println("out execute----9:" + ExpressionUtil.ScanExpression("(2 * (2 + 3)) * ( 12-6)"));
			System.out.println("out execute----10:" + ExpressionUtil.ScanExpression("61 == (2 * (2 + 3)) * ( 12-6)"));
			System.out.println("out execute----11:" + ExpressionUtil.ScanExpression("(2 * (2 + 3)) * ( 12-6) == 60"));
			System.out.println("out execute----12:" + ExpressionUtil.ScanExpression("(3 * (3 + 6)) - ( 12-6) + (6-134) * (15 -23)"));
			System.out.println("out execute----13:" + ExpressionUtil.ScanExpression("(3 * 9) -6  + 128 * 9"));
			System.out.println("out execute----14:" + ExpressionUtil.ScanExpression("-931-(3 * 9) --6  + 128 * (-10 + 103-3094)"));
			System.out.println("out execute----15:" + ExpressionUtil.ScanExpression("-931-(3 * 9) -6  + 128 * (-10 + 103-3094)"));
			System.out.println("out execute----16:" + ExpressionUtil.ScanExpression("-931-(3 * 9) -6  + 128 * (-10 + 103<<3094)"));
			System.out.println("out execute----17:" + ExpressionUtil.ScanExpression("103>>2"));
			/** 加载UML 3 * 9 - 6 + -128 * -8   */
			/* 27 - 8 + 1024 */

			//NeuronsWorld neuronsWorld = new NeuronsWorld();
			//neuronsWorld.load(path); 

			//if (pool == null) {
			//	pool = new ZTecThreadsPool(30, 20, 6, 4);
			//}
			/* 启动线程池 */
			// Object sender = new Object();
			// pool.execute(sender);
			// neuronsWorld.getNeurons().forEach(neuron -> {
			// 	pool.push((ITaskItemAble)neuron);
			// }); 

			/* 控制，与信息交流, 启动神经元 */			
			//OrganizationCell organizationCell = new OrganizationCell();
			//organizationCell.start();

			// File dir = new File("D:\\work\\Path\\Exec\\Dock202510");
			// boolean create = dir.mkdirs();
			// if( !create ){
			// 	throw new Exception("创建目录失败。");
			// }
			//Files.createDirectories(Paths.get("D:\\work\\Path\\Exec\\Dock202510"));
			//UtilTools.createNewPaths("D:\\work\\Path\\Exec\\Dock202510");
			
			
			//PropertyGroup prop = new PropertyGroup();
			//Project project = NeuronProjectTools.createProject(prop);
			//MessageForTalk msg = new MessageForTalk();
			//msg.setTalk("TestUML");
			//neuronsWorld.sendMessage(project, msg);

			


		} catch(Exception e) {
			logger.error("异常：" + e.getMessage());
		}
	}

}
